package cn.com.fuhuitong.http

import cn.com.fuhuitong.main.host.entity.ConfigResponse
import cn.com.fuhuitong.main.mine.entity.AddressDefaultResponse
import cn.com.fuhuitong.main.order.entity.AliPayResponse
import cn.com.fuhuitong.main.order.entity.WXPayResponse
import io.reactivex.Observable
import retrofit2.http.*

interface BaseApiService {

    /**
     * 获取配置信息
     * */
    @FormUrlEncoded
    @POST("/api/common/config_value")
    fun configValue(
        @Field("name") name: Array<String>//health_ambassador_text=健康大使说明,help_center=帮助中心，flagship_store=旗舰店说明，description_family_station=家庭驿站说明 contract=合同
    ): Observable<ConfigResponse>

    /**
     * 添加购物车
     * */
    @FormUrlEncoded
    @POST("/api/goods/add_shop_cart")
    fun goodsAddCart(
        @Header("token") token: String,
        @Field("goods_id") goodsId: String,
        @Field("num") num: String,
        @Field("specifications_id") specsId: String,
        @Field("user_id") userId: String
    ): Observable<BaseResponse>

    /**
     * 添加收藏
     * */
    @FormUrlEncoded
    @POST("/api/goods/add_goods_collection")
    fun addGoodsCollection(
        @Header("token") token: String,
        @Field("goods_id") goodsId: String
    ): Observable<BaseResponse>

    /**
     * 默认地址
     * */
    @GET("/api/address/get_address_default")
    fun addressDefault(
        @Header("token") token: String
    ): Observable<AddressDefaultResponse>

    /**
     * 微信支付
     * */
    @FormUrlEncoded
    @POST("/api/order/price_pay")
    fun wxPay(
        @Header("token") token: String,
        @Field("order_id") orderId: String,
        @Field("type") type: String = "1"//类型:1=微信,2=支付宝
    ): Observable<WXPayResponse>

    /**
     * 阿里支付
     * */
    @FormUrlEncoded
    @POST("/api/order/price_pay")
    fun aliPay(
        @Header("token") token: String,
        @Field("order_id") orderId: String,
        @Field("type") type: String = "2"//类型:1=微信,2=支付宝
    ): Observable<AliPayResponse>

}